// For tabbed navigation links, scrolling tabs, etc. For all top/main navigation,
// please check nav.scss
.nav-links {
  display: flex;
  padding: 0;
  margin: 0;
  list-style: none;
  height: auto;
  border-bottom: 1px solid $border-color;

  li:not(.md-header-toolbar) {
    display: flex;

    a,
    button {
      padding: $gl-spacing-scale-5 $gl-spacing-scale-4;
      font-size: $gl-font-size;
      line-height: $gl-line-height-16;
      color: $gl-text-color-secondary;
      border: 0;
      white-space: nowrap;

      &:hover,
      &:active,
      &:focus {
        text-decoration: none;
        color: $black;
        box-shadow: inset 0 -2px 0 0 $gray-darkest;
      }
    }

    button {
      padding-top: 0;
      background-color: transparent;
    }

    &.active a,
    &.active button,
    a.active {
      color: $black;
      font-weight: $gl-font-weight-bold;
      box-shadow: inset 0 -2px 0 0 $blue-500;

      .badge.badge-pill {
        color: $black;
        font-weight: $gl-font-weight-bold;
      }
    }

    &.md-header-tab button {
      line-height: 19px;
    }
  }
}

.top-area {
  border-bottom: 1px solid $border-color;
  display: flex;

  @include media-breakpoint-down(md) {
    flex-flow: column-reverse wrap;
  }

  .nav-text {
    flex: 1;
    padding-top: 16px;
    padding-bottom: 11px;
    display: inline-block;
    line-height: 28px;
    white-space: normal;

    /* Small devices (phones, 768px and lower) */
    @include media-breakpoint-down(xs) {
      width: 100%;
    }
  }

  .nav-links {
    border-bottom: 0;
    flex: 1;

    &.wide {
      width: 100%;
      display: block;
    }

    &.scrolling-tabs {
      float: left;
    }

    /* Small devices (phones, 768px and lower) */
    @include media-breakpoint-down(sm) {
      width: 100%;
    }
  }

  .nav-controls {
    display: inline-block;
    text-align: right;

    > .btn,
    > .btn-group,
    > .btn-container,
    > .dropdown,
    > input,
    > form {
      margin-right: $gl-padding-8;

      &:last-child {
        margin-right: 0;
        float: right;
      }
    }

    > .btn-grouped {
      float: none;
    }

    .icon-label {
      display: none;
    }

    input {
      display: inline-block;
      position: relative;
    }

    @include media-breakpoint-up(md) {
      display: flex;
      align-items: center;
    }

    @include media-breakpoint-down(md) {
      flex: 0 0 100%;
      margin-top: $gl-padding-8;
    }

    @include media-breakpoint-down(sm) {
      padding-bottom: 0;
      width: 100%;

      .btn,
      form,
      .dropdown,
      .dropdown-toggle,
      .dropdown-menu-toggle,
      .form-control,
      > .btn-group {
        margin: 0 0 $gl-padding-8;
        display: block;
        width: 100%;
      }

      .btn.dropdown-toggle-split {
        margin-left: 1px;
      }

      /* This resets the width of the control so that the search button doesn't wrap */
      .gl-search-box-by-click .form-control {
        width: 1%;
      }

      .dropdown-menu-toggle {
        margin-bottom: 0;
      }

      form {
        display: block;
        height: auto;
        margin-bottom: $gl-padding-8;

        input {
          width: 100%;
          margin: 0 0 10px;
        }
      }

      .icon-label {
        display: inline-block;
      }

      &.inline {
        display: flex;
        flex-flow: row wrap;
        justify-content: space-between;

        > .btn,
        > .btn-container,
        > .dropdown,
        > input,
        > form {
          flex: 1 1 auto;
          margin: 0 0 10px;
          margin-left: $gl-padding-top;
          width: auto;

          &:first-child {
            margin-left: 0;
            float: none;
          }
        }

        .btn-full {
          flex: 1 1 100%;
          margin-left: 0;
        }
      }
    }
  }

  &.adjust {
    .nav-text,
    .nav-controls {
      width: auto;

      @include media-breakpoint-down(xs) {
        width: 100%;
      }
    }
  }

  &.multi-line {
    .nav-text {
      line-height: 20px;
    }

    .nav-controls {
      padding: 17px 0;
    }
  }

  pre {
    width: 100%;
  }
}

.scrolling-tabs-container {
  position: relative;

  .merge-request-tabs-container & {
    overflow: hidden;
  }

  .nav-links {
    @include scrolling-links();
  }

  .fade-left::after,
  .fade-right::after {
    content: '';
    pointer-events: none;
    z-index: -1;
    display: block;
    width: 16px;
    height: 100%;
    position: absolute;
    top: 0;
  }

  .fade-right {
    @include fade(left, $gray-light);
    right: -5px;

    svg {
      right: -7px;
    }

    &::after {
      right: 0;
      background: linear-gradient(270deg, $white, transparent);
    }
  }

  .fade-left {
    @include fade(right, $gray-light);
    left: -5px;
    text-align: center;

    svg {
      left: -7px;
    }

    &::after {
      left: 0;
      background: linear-gradient(90deg, $white, transparent);
    }
  }
}

.inner-page-scroll-tabs {
  .fade-right {
    @include fade(left, $white);
    right: 0;
    text-align: right;

    svg {
      right: 5px;
    }
  }

  .fade-left {
    @include fade(right, $white);
    left: 0;
    text-align: left;

    svg {
      left: 5px;
    }
  }

  .fade-right,
  .fade-left {
    top: auto;
  }

  &.is-smaller {
    .fade-right,
    .fade-left {
      top: 11px;
    }
  }
}

.nav-block {
  position: relative;

  .nav-links {
    @include scrolling-links();

    .fade-right {
      @include fade(left, $white);
      right: -5px;

      svg {
        right: -7px;
      }
    }

    .fade-left {
      @include fade(right, $white);
      left: -5px;

      svg {
        left: -7px;
      }
    }
  }

  &.activities {
    display: flex;
    border-bottom: 1px solid $border-color;
    overflow: hidden;
    align-items: center;

    .nav-links {
      border-bottom: 0;
    }

    @include media-breakpoint-down(xs) {
      display: block;
      overflow: visible;
    }
  }
}
